import absfactory.Factory;
import absfactory.IFactory;
import observale.RealSubject;
import observale.WxObserver;
import observer2.BookObserable;
import observer2.User1Observer;
import observer2.User2Observer;

public class Main {

    public static void main(String[] args) {
        IFactory factory = new Factory();
        factory.getCar1().showPrice();
        factory.getCar2().showColor();
//        观察者
        RealSubject subject = new RealSubject();
        subject.attach(new WxObserver("a"));
        subject.attach(new WxObserver("b"));
        subject.attach(new WxObserver("b"));
//        更新消息
        subject.notify("this is a good idea");

        BookObserable bookObserable = new BookObserable();
        bookObserable.addObserver(new User1Observer("a"));
        bookObserable.addObserver(new User2Observer("b"));
        bookObserable.onclick("有新书要上市了");
    }
}
